package {{basePackage}}.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDateTime;
{{#each importTypes}}
import {{this}};
{{/each}}

/**
 * {{tableComment}} 数据传输对象
 * 
 * @author {{author}}
 * @version {{version}}
 * @since {{createTime}}
 */
@Data
@Schema(description = "{{tableComment}}DTO")
public class {{entityName}}DTO implements Serializable {

    private static final long serialVersionUID = 1L;

    {{#each fields}}
    {{#unless isPrimaryKey}}
    /**
     * {{comment}}
     */
    @Schema(description = "{{comment}}"{{#if required}}, required = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}})
    {{#if required}}
    {{#if (eq javaType "String")}}
    @NotBlank(message = "{{comment}}不能为空")
    {{else}}
    @NotNull(message = "{{comment}}不能为空")
    {{/if}}
    {{/if}}
    {{#if (eq javaType "String")}}
    {{#if maxLength}}
    @Size(max = {{maxLength}}, message = "{{comment}}长度不能超过{{maxLength}}个字符")
    {{/if}}
    {{/if}}
    {{#if (eq javaType "Integer")}}
    {{#if min}}
    @Min(value = {{min}}, message = "{{comment}}不能小于{{min}}")
    {{/if}}
    {{#if max}}
    @Max(value = {{max}}, message = "{{comment}}不能大于{{max}}")
    {{/if}}
    {{/if}}
    {{#if pattern}}
    @Pattern(regexp = "{{pattern}}", message = "{{comment}}格式不正确")
    {{/if}}
    private {{javaType}} {{fieldName}};

    {{/unless}}
    {{/each}}
}
